<div class="row" ng-controller="addContent">
    <div class="col-xs-12">
        <div class="box box-default">
            <div class="box-header">
                <div class="alert alert-success alert-dismissable fade in hide" role="alert" id="addSuccess">
                    <button aria-hidden="true" data-dismiss="alert" class="close" type="button">×</button>
                    <p><i class="icon fa fa-check"></i> <strong>恭喜！</strong>内容添加成功</p>
                </div>
                <p class="myInfoBox bg-warning text-warning"><i class="icon fa fa-warning"></i> 信息填写完整无误才可提交</p>
            </div>
            <div class="box-body">
                <form role="form" class="form-horizontal" name="myForm" ng-submit="processForm(myForm.$valid)" novalidate>
                    <div class="form-group">
                        <label class="control-label col-sm-3">文章标题</label>
                        <div class="col-sm-5">
                            <input type="text" class="form-control input-sm" name="title" ng-minlength="5" ng-maxlength="50" ng-model="formData.title" required/>
                            <label for="inputError" class="control-label text-danger" ng-show="myForm.title.$invalid && !myForm.title.$pristine"><i class="fa fa-times-circle-o"></i> 5-50个非特殊字符</label>

                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-3">简短标题</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control input-sm" name="stitle" ng-minlength="5" ng-maxlength="40" ng-model="formData.stitle" required/>
                            <label for="inputError" class="control-label text-danger" ng-show="myForm.stitle.$invalid && !myForm.stitle.$pristine"><i class="fa fa-times-circle-o"></i> 5-40个非特殊字符</label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-3">来源</label>
                        <div class="radio col-sm-4">
                            <label>
                                <input type="radio" checked class="mini" value="1" name="from" ng-model="formData.from"/>原创&nbsp;
                            </label>
                            <label>
                                <input type="radio" class="mini" name="from" value="2" ng-model="formData.from"/>转载
                            </label>
                        </div>
                    </div>
                    <div class="form-group hide">
                        <label class="control-label col-sm-3">发布</label>
                        <div class="checkbox col-sm-4">
                            <label>
                                <input type="checkbox" checked class="mini" name="state" ng-model="formData.state"/>是
                            </label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-3">TAG标签</label>
                        <div class="col-sm-4">
                            <div class="input-group">
                                <input type="text" class="form-control" name="tags" id="tagSel" ng-minlength="2" ng-maxlength="27" ng-model="formData.tags" onclick="showTagsMenu()" required/>
                                <div class="input-group-btn">
                                    <button type="button" class="btn btn-default dropdown-toggle"  id="menuBtn" onclick="showTagsMenu(); return false;">选择 <span class="fa fa-caret-down"></span></button>
                                    <div id="menuContent" class="menuContent dropdown-menu" style="display:none; position: absolute;z-index: 999">
                                        <ul class="ztree" id="tagsTree" style="margin-top: 0;width: 180px;max-height: 200px;overflow-y: auto;padding: 10px;background: #fff;"></ul>
                                    </div>
                                </div><!-- /btn-group -->
                            </div><!-- /input-group -->
                            <label for="inputError" class="control-label text-danger" ng-show="myForm.tags.$invalid && !myForm.tags.$pristine"><i class="fa fa-times-circle-o"></i>标签用逗号隔开，单个标签不可超过6个字，不得超过4个标签</label>
                        </div>
                        <div class="col-sm-2">
                            <a href="#addContentTags" role="button" class="btn btn-link" data-toggle="modal"><span class="fa fa-tags" aria-hidden="true">&nbsp;</span>新标签</a>

                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-3">缩略图</label>
                        <div class="col-sm-3">
                            <input type="file" name="uploadify" id="uploadContentImg" />
                            <img src="" alt="" width="120" height="120" class="img-thumbnail" id="myImg">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-3">文章类别</label>
                        <div class="col-sm-2">
                            <div class="dropdown">
                                <button id="dLabel" class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                    <i id="categoryName">请选择文章类别</i>
                                    <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel" id="cateTree" class="ztree">
                                    <li role="presentation"><a href="#">test</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-3">关键字</label>
                        <div class="col-sm-5">
                            <input type="text" class="form-control input-sm" name="keywords" ng-minlength="2" ng-maxlength="60" ng-model="formData.keywords" required/>
                            <label for="inputError" class="control-label text-danger" ng-show="myForm.keywords.$invalid && !myForm.keywords.$pristine"><i class="fa fa-times-circle-o"></i>60个字以内，多个关键字之间用逗号隔开</label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-3">内容摘要</label>
                        <div class="col-sm-6">
                            <textarea class="form-control input-sm" name="discription" ng-model="formData.discription" ng-minlength="15" ng-maxlength="140" required id="" cols="30" rows="6"></textarea>
                            <label for="inputError" class="control-label text-danger" ng-show="myForm.discription.$invalid && !myForm.discription.$pristine"><i class="fa fa-times-circle-o"></i> 15-140个非特殊字符</label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-3">文章详情</label>
                        <div class="col-sm-8">
                            <textarea class="" name="comments" ng-model="formData.comments" id="container" ng-minlength="50" placeholder="请输入文章详情" ueditor>{{formData.comments}}</textarea>
                            <label for="inputError" class="control-label text-danger" ng-show="myForm.comments.$invalid && !myForm.comments.$pristine"><i class="fa fa-times-circle-o"></i>内容不得少于50个字</label>

                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" ng-show="getContentState()" ng-click="saveAsDraft()">存为草稿</button>
                        <button type="submit" class="btn btn-primary" ng-disabled="myForm.$invalid">发布</button>
                    </div>
                </form>

            </div>
        </div>
    </div>

    <!--添加用户组模态窗口-->
    <div class="modal fade" id="addContentTags">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">新增标签</h4>
                </div>
                <div class="modal-body">
                    <form role="form" class="form-horizontal" name="tagForm" ng-submit="addNewTagForm(tagForm.$valid)" novalidate>
                        <div class="form-group">
                            <label class="control-label col-sm-4">标签名称</label>
                            <div class="col-sm-6">
                                <input type="text" class="form-control" name="name" ng-model="tagFormData.name" ng-minlength="1" ng-maxlength="12" required/>
                                <label for="inputError" class="control-label text-danger" ng-show="tagForm.name.$invalid && !tagForm.name.$pristine"><i class="fa fa-times-circle-o"></i> 1-12个非特殊字符</label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-4">别名</label>
                            <div class="col-sm-6">
                                <input type="text" class="form-control" name="alias" ng-model="tagFormData.alias" ng-pattern="/^[a-zA-Z][a-zA-Z0-9_]{2,11}$/" required/>
                                <label for="inputError" class="control-label text-danger" ng-show="tagForm.alias.$invalid && !tagForm.alias.$pristine"><i class="fa fa-times-circle-o"></i> 2-12个英文字符</label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-sm-4">标签备注</label>
                            <div class="col-sm-6">
                                <input type="text" class="form-control" name="comments" ng-model="tagFormData.comments" ng-minlength="1" ng-maxlength="30" required/>
                                <label for="inputError" class="control-label text-danger" ng-show="tagForm.comments.$invalid && !tagForm.comments.$pristine"><i class="fa fa-times-circle-o"></i> 备注不能为空</label>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <button type="submit" class="btn btn-primary" ng-disabled="tagForm.$invalid">提交</button>
                        </div>
                    </form>

                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->
    </div>
</div>

